*****************************************************************************************************************************************************
* PROJECT: 		Exposure to the COVID-19 Stock Market Crash and its Effect on Household Expectations
* DATE: 		Nov 2020
* CONTENT: 		TABLES
* AUTHORS: 		Tobin Hanspal, Johannes Wohlfart, Anni Weber
*****************************************************************************************************************************************************

		clear all
		set scheme lean2
		global pm = char(177)
		set more off
		gl date = c(current_date)
		graph set window fontface "cmr10"		
		
* set cd as /Replication_files_HanspalWeberWohlfart2020/


*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~						
** Table A6
*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~	
	
use data/processed/data_1, clear 

foreach var of varlist expec_debthigher expec_morehrs expec_retirlater never_ownwealth never_owninc ///
realized_anychangestocks realized_morestocks realized_lessstocks planned_anychangestocks planned_morestocks planned_lessstocks {
	gen `var'_00=100* `var' 
}
* 
keep if control_pure==1 

global controls ln_hhnetinc hhnetinc19_NR ///
						ln_ofinwealth_lvl ln_retirewealth_lvl  ///
						ln_realestate_lvl realestJan20_NR		///
						ln_debt_lvl  debtJan20_NR ///
						stockinvestor riskshare_finwealth_Jan201 stockexperience ///
						i.agecat male married separated_divorced widowed ///	
						highschool some_college_associate_degree atleast_bachelor  ///
						mainearner_alone z_constrained self_empl retired unempl empl_other ///
						republican other_party NR_party  ///
						z_decisionmaker  ///
						i.region i.svydate i.treatment  	
loc experiments "recovery_duration exp_ret_mean exp_ret_sd retdist_neg30 retdist_pos30 recov_hhwealth_duration never_ownwealth_00 z_finprospect"

preserve

clear all
eststo clear
estimates drop _all

set obs 10
qui gen x = 1
qui gen y = 1

loc columns = 0

foreach choice in `experiments' {

    loc ++columns
    qui eststo col`columns': reg x y

}

restore

loc colnum = 1
loc colnames ""

foreach choice in `experiments' {
reg `choice' del_finwealth_perc_tr02 ///
		del_hhnetinc_perc_tr02   ///
		fincrisis dotcom bm fincrisis_big dotcom_big bm_big   ///
		$controls ///
		, robust 
		
local N=e(N)
local r2=round(e(r2_a),.001)

sigstar del_finwealth_perc_tr02, prec(3)
estadd loc thisstat2 = "`r(bstar)'": col`colnum'
estadd loc thisstat3 = "`r(sestar)'": col`colnum'

sigstar del_hhnetinc_perc_tr02, prec(3)
estadd loc thisstat5 = "`r(bstar)'": col`colnum'
estadd loc thisstat6 = "`r(sestar)'": col`colnum'

sigstar fincrisis, prec(3)
estadd loc thisstat8 = "`r(bstar)'": col`colnum'
estadd loc thisstat9 = "`r(sestar)'": col`colnum'

sigstar fincrisis_big, prec(3)
estadd loc thisstat11 = "`r(bstar)'": col`colnum'
estadd loc thisstat12 = "`r(sestar)'": col`colnum'

sigstar dotcom, prec(3)
estadd loc thisstat14 = "`r(bstar)'": col`colnum'
estadd loc thisstat15 = "`r(sestar)'": col`colnum'

sigstar dotcom_big, prec(3)
estadd loc thisstat17 = "`r(bstar)'": col`colnum'
estadd loc thisstat18 = "`r(sestar)'": col`colnum'

sigstar bm, prec(3)
estadd loc thisstat20 = "`r(bstar)'": col`colnum'
estadd loc thisstat21 = "`r(sestar)'": col`colnum'

sigstar bm_big, prec(3)
estadd loc thisstat23 = "`r(bstar)'": col`colnum'
estadd loc thisstat24 = "`r(sestar)'": col`colnum'

sigstar male, prec(3)
estadd loc thisstat26 = "`r(bstar)'": col`colnum'
estadd loc thisstat27 = "`r(sestar)'": col`colnum'

sigstar atleast_bachelor, prec(3)
estadd loc thisstat29 = "`r(bstar)'": col`colnum'
estadd loc thisstat30 = "`r(sestar)'": col`colnum'

sigstar republican, prec(3)
estadd loc thisstat32 = "`r(bstar)'": col`colnum'
estadd loc thisstat33 = "`r(sestar)'": col`colnum'

sigstar stockinvestor, prec(3)
estadd loc thisstat35 = "`r(bstar)'": col`colnum'
estadd loc thisstat36 = "`r(sestar)'": col`colnum'

estadd loc thisstat38 "Yes": col`colnum'
estadd loc thisstat39= `r2': col`colnum'
estadd loc thisstat40 = `N': col`colnum'

loc ++colnum
loc colnames "`colnames' `"`: var la `choice''"'"

}

loc rowlabels " " " "$\Delta$ Fin. wealth (\%)" " " " " "$\Delta$ Net income (\%)" " " " " "Any loss fin. crisis" " " " " "Big loss fin. crisis" " " " " "Any loss dot-com" " " " " "Big loss dot-com" " " " " "Any loss Black Monday" " " " " "Big loss Black Monday" " " " " "Male" " " " " "At least bachelor" " " " " "Republican" " " " " "Stock investor" " " " " "Individual controls" "Adj. R-squared" "Observations" " 

forval i = 1/40 {
    loc rowstats "`rowstats' thisstat`i'"
}

esttab * using "Tables\TableA6.tex", replace cells(none) booktabs nonotes nomtitles compress alignment(c) nogap noobs nobaselevels label stats(`rowstats', labels(`rowlabels')) ///
     mgroups("\shortstack{Stock\\recovery\\duration}" "\shortstack{Stock\\return:\\Mean}" "\shortstack{Stock\\return:\\SD}" "\shortstack{Stock \\ return \\ <-30\%}" "\shortstack{Stock \\ return \\ >30\%}" ///
"\shortstack{Wealth\\recovery\\duration}" "\shortstack{Exp. wealth\\never to\\recover}" "\shortstack{Household \\ financial \\ prospects}", pattern(1 1 1 1 1 1 1 1 ) prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))






